/**
 * Descriptions：
 * <p>
 * Author：ChenME
 * Date：2017/6/20
 * Email：ibelieve1210@163.com
 */
import React, {Component} from 'react';
import {
    StyleSheet,
    Text,
    View,
    ToastAndroid,
    Image,
} from 'react-native';

import {TabNavigator, TabBarBottom} from 'react-navigation';

import {HomePage} from '../home/CMEHome';
import CMEShop from '../shop/CMEShop';
import CMEMine from '../mine/CMEMine';
import {MorePage} from '../more/CMEMore';


const CMEMain = TabNavigator({
    CMEHome: {
        screen: HomePage,
        navigationOptions: {
            title: '首页',
            tabBarIcon: ({focused, tintColor}) => (
                <Image
                    source={focused ? {uri: 'icon_tabbar_homepage_selected'} : {uri: 'icon_tabbar_homepage'}}
                    style={ styles.tabBarIcon }
                />
            ),
        }
    },
    CMEShop: {
        screen: CMEShop,
        navigationOptions: ({navigation}) => ({
            title: '商家',
            tabBarIcon: ({focused, tintColor}) => (
                <Image
                    source={focused ? {uri: 'icon_tabbar_merchant_selected'} : {uri: 'icon_tabbar_merchant_normal'}}
                    style={ styles.tabBarIcon }
                />
            ),
        }),
    },
    CMEMine: {
        screen: CMEMine,
        navigationOptions: ({navigation}) => ({
            title: '我的',
            tabBarIcon: ({focused, tintColor}) => (
                <Image
                    source={focused ? {uri: 'icon_tabbar_mine_selected'} : {uri: 'icon_tabbar_mine'}}
                    style={ styles.tabBarIcon }
                />
            ),
        }),
    },
    CMEMore: {
        screen: MorePage,
        navigationOptions: ({navigation}) => ({
            title: '更多',
            tabBarIcon: ({focused, tintColor}) => (
                <Image
                    source={focused ? {uri: 'icon_tabbar_misc_selected'} : {uri: 'icon_tabbar_misc'}}
                    style={ styles.tabBarIcon }
                />
            ),
        }),
    },

}, {
    tabBarComponent: TabBarBottom,
    tabBarPosition: 'bottom',
    swipeEnabled: false,
    animationEnabled: true,
    lazy: true,
    backBehavior: 'none',
    tabBarOptions: {
        activeBackgroundColor: 'white',
        activeTintColor: '#4ecbfc',
        inactiveBackgroundColor: 'white',
        inactiveTintColor: '#aaa',
        showLabel: true,
        showIcon: true,
        style: {
            height: 48,
            backgroundColor: '#ffffff',
        },
        labelStyle: {
            fontSize: 14, // 文字大小
        },
        indicatorStyle: {
            height: 0
        },
    }
});

const styles = StyleSheet.create({
    tabBarIcon: {
        // tintColor: tintColor,
        width: 25,
        height: 25,
    },
});

export {CMEMain} ;